﻿<UserControl x:Class="SoftTeach.View.Sitzpläne.RaumWorkspaceView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:sitzpläne="clr-namespace:SoftTeach.ViewModel.Sitzpläne"
             xmlns:sitzpläneView="clr-namespace:SoftTeach.View.Sitzpläne"
             xmlns:softTeach="clr-namespace:SoftTeach"
             mc:Ignorable="d" 
             d:DesignHeight="400" d:DesignWidth="800"
             DataContext="{Binding Source={x:Static softTeach:App.MainViewModel}, Path=RaumWorkspace}">
  <Grid>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="250"/>
      <ColumnDefinition/>
    </Grid.ColumnDefinitions>
    <Grid Grid.Column="0">
      <Grid>
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto"/>
          <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0" Orientation="Horizontal">
          <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Command="{Binding Path=AddRaumCommand}" 
                    ToolTip="Neuen Raum erstellen">
            <StackPanel Orientation="Horizontal">
              <Grid>
                <Image Source="/SoftTeach;component/Images/Raum32.png"/>
                <Image Source="/SoftTeach;component/Images/AddOverlay32.png"/>
              </Grid>
            </StackPanel>
          </Button>
          <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
                    Command="{Binding Path=DeleteRaumCommand}" 
                    ToolTip="Aktuellen Raum löschen.">
            <StackPanel Orientation="Horizontal">
              <Grid>
                <Image Source="/SoftTeach;component/Images/Raum32.png"/>
                <Image Source="/SoftTeach;component/Images/RemoveOverlay32.png"/>
              </Grid>
            </StackPanel>
          </Button>
        </StackPanel>
        <DataGrid Grid.Row="1"  Margin="5" SelectedItem="{Binding Path=CurrentRaum, Mode=TwoWay}" 
                    IsReadOnly="True"
                    ItemsSource="{Binding Source={x:Static softTeach:App.MainViewModel}, Path=Räume}" AutoGenerateColumns="False" >
          <DataGrid.Columns>
            <DataGridTextColumn Header="Raumbezeichnung" Binding="{Binding Path=RaumBezeichnung}" Width="Auto"
                                  SortMemberPath="RaumBezeichnung" IsReadOnly="True"/>

          </DataGrid.Columns>
        </DataGrid>
      </Grid>
    </Grid>
    <Grid Grid.Column="1">
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
      </Grid.RowDefinitions>
      <ContentControl Grid.Row="1" Content="{Binding Path=CurrentRaum}">
        <ContentControl.Resources>
          <DataTemplate DataType="{x:Type sitzpläne:RaumViewModel}">
            <sitzpläneView:RaumDetailView />
          </DataTemplate>
        </ContentControl.Resources>
      </ContentControl>
    </Grid>
  </Grid>
</UserControl>
